package com.offcn.user.controller;

import com.offcn.user.bean.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: wzy
 * @Date: 2021/01/24/16:11
 * @Description:
 */
@RestController
@Api(tags = "第一个Swagger测试")
public class HelloController {

    @GetMapping("/hello")
    @ApiOperation("测试方法hello")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "name",value = "姓名",required = true),
            @ApiImplicitParam(name = "age",value = "年龄")
    })
    public String hello(String name){
        return "Ok   ----  "+name;
    }


    @PostMapping("/user")
    @ApiOperation("保存用户")
    @ApiImplicitParams(value = {
    @ApiImplicitParam(name = "name",value = "姓名",required = true),
            @ApiImplicitParam(name = "email",value = "电子邮件")}
    )
    public User save(String name,String email){
        User user = new User();
        user.setName(name);
        user.setEmail(email);
        return user;

    }
}
